/*
 *  Copyright 2008-2010 www.jrails.org
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

package org.rails.extjs.panel;

import org.rails.extjs.AbsBase;
import org.rails.extjs.javascript.Function;

public class Tool extends AbsBase {
	
	public final static String TOGGLE = "toggle";
	public final static String CLOSE = "close";
	public final static String MINIMIZE = "minimize";
	public final static String MAXIMIZE = "maximize";
	public final static String RESTORE = "restore";
	public final static String GEAR = "gear";
	public final static String PIN = "pin";
	public final static String UNPIN = "unpin";
	public final static String RIGHT = "right";
	public final static String LEFT = "left";
	public final static String UP = "up";
	public final static String DOWN = "down";
	public final static String REFRESH = "refresh";
	public final static String MINUS = "minus";	
	public final static String PLUS = "plus";
	public final static String HELP = "help";
	public final static String SEARCH = "search";
	public final static String SAVE = "save";
	public final static String PRINT = "print";
	
	public Tool(String id) {
		super();
		setId(id);
	}
	
	public Tool(String id,Function handler) {
		super();
		setId(id);
		setHandler(handler);
	}
	
	public void setId(String id){
		addOption("id",id);
	}
	
	public String getId(){
		return getString("id","");
	}
	
	public void setHandler(Function handler){
		addOption("handler", handler);
	}
	
	public Function getHandler(){
		return (Function)getOption("handler");
	}
	
	public void setStopEvent(Boolean stopEvent){
		addOption("stopEvent",stopEvent);
	}
	
	public Boolean isStopEvent(){
		return getBoolean("stopEvent",true);
	}
	
	public void setQtip(String qtip){
		addOption("qtip",qtip);
	}
	
	public String getQtip(String qtip){
		return getString("qtip","");
	}
	
	public void setHidden(Boolean hidden){
		addOption("hidden",hidden);
	}

	public Boolean isHidden(){
		return getBoolean("hidden",false);
	}
	
	@Override
	public String getScript() {
		return createOptions();
	}
	

}
